package com.wyw.design.model.learning.structure.flyweight;

/**
 * @Title
 * @Description
 * @Author Mr Wu yewen.wu.china@gmail.com
 * @Date 2023/3/30 18:10
 * Update History:
 * Author        Time            Content
 */
public class FlyWeightTest {
    public static void main(String[] args) {

        // 假设有2个科目，初始化一遍池子
        for (int i = 0; i < 2; i++) {
            String subject = "科目" + i;
            ExamInfoFactory.getExamInfo(subject);
        }
        // 假设3个考生考试
        for(int i = 0; i < 3; i++) {
            for (int j = 0; j < 2; j++) {
                ExamInfo examInfo = ExamInfoFactory.getExamInfo("科目" + j);
                examInfo.setUser("考生" + i);
                System.out.println(examInfo);
            }
        }
    }
}
